package com.info.zhiduoduo.pay.sdk.zhaoshangbank.model.request.tradebulter.detail;

import com.google.common.collect.Lists;
import com.info.zhiduoduo.pay.formbean.zhaoshangtradebulter.SubLedgerPayFormBean;

import java.util.List;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class SubLedgerPayInfo {

	/*
	* {
                    "accnbr": "769900002110411",
                    "dmadbt": "000001",
                    "dmacrt": "456123",
                    "trxamt": "1.10",
                    "trxtxt": ""
                }
	* */

	/** 账号	accnsbr	String(35)	Y */
	private String accnbr;
	/** 付款方记账子单元编号	dmadbt	String(20)	Y */
	private String dmadbt;
	/** 收款方记账子单元编号	dmacrt	String(20)	Y */
	private String dmacrt;
	/** 转账金额	trxamt	M	Y */
	private String trxamt;
	/** 交易摘要	trxtxt	Z(42)	 */
	private String trxtxt;

	public static List<SubLedgerPayInfo> ofList(SubLedgerPayFormBean formBean) {
		List<SubLedgerPayInfo> list = Lists.newArrayList();
		SubLedgerPayInfo info = new SubLedgerPayInfo().setAccnbr(formBean.getAccountNo())
				.setDmadbt(formBean.getPayerLedgerNo())
				.setDmacrt(formBean.getPayeeLedgerNo())
				.setTrxamt(formBean.getAmount())
				.setTrxtxt(formBean.getNote());
		list.add(info);
		return list;
	}
}
